/*
 * Copyright (c) 2013 Tob
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

package de.tudarmstadt.kom.androidsensorapi.test.datarepresentation.location;

import android.test.AndroidTestCase;

import de.tudarmstadt.kom.androidsensorapi.datarepresentation.location.SimpleLocation;


/**
 * Created by Tobias Welther
 */
public class SimpleLocationTest extends AndroidTestCase{


    public void testGetLatitude() throws Exception {
        double valueToCheck = 1337.42;

        SimpleLocation location = new SimpleLocation(valueToCheck, 0, 0, 0, 0);
        assertEquals(valueToCheck, location.getLatitude(), 0.001);
    }

    public void testGetLongitude() throws Exception {
        double valueToCheck = 1337.42;

        SimpleLocation location = new SimpleLocation(0, valueToCheck, 0, 0, 0);
        assertEquals(valueToCheck, location.getLongitude(), 0.001);
    }

    public void testGetHeight() throws Exception {
        double valueToCheck = 1337.42;

        SimpleLocation location = new SimpleLocation(0, 0, valueToCheck, 0, 0);
        assertEquals(valueToCheck, location.getHeight(), 0.001);
    }

    public void testGetSpeed() throws Exception {
        double valueToCheck = 2.5;

        SimpleLocation location = new SimpleLocation(0, 0, 0, valueToCheck, 0);
        assertEquals(valueToCheck, location.getSpeed(), 0.001);
    }


    public void testGetAccuracy() throws Exception {
        double valueToCheck = 2.5;

        SimpleLocation location = new SimpleLocation(0, 0, 0, 0, valueToCheck);
        assertEquals(valueToCheck, location.getAccuracy(), 0.001);
    }


    public void testIsSpeedPresent() throws Exception {
        double invalidValue = Double.MIN_VALUE;
        double validValue = 2.42;

        SimpleLocation location = new SimpleLocation(0, 0, 0, invalidValue, 0);
        assertFalse(location.isSpeedPresent());

        SimpleLocation location2 = new SimpleLocation(0, 0, 0, validValue, 0);
        assertTrue(location2.isSpeedPresent());
    }


    public void testIsHeightPresent() throws Exception {
        double invalidValue = Double.MIN_VALUE;
        double validValue = 2.42;

        SimpleLocation location = new SimpleLocation(0, 0, invalidValue, 0, 0);
        assertFalse(location.isHeightPresent());

        SimpleLocation location2 = new SimpleLocation(0, 0, validValue, 0, 0);
        assertTrue(location2.isHeightPresent());
    }


    public void testIsAccuracyPresent() throws Exception {
        double invalidValue = Double.MIN_VALUE;
        double validValue = 2.42;

        SimpleLocation location = new SimpleLocation(0, 0, 0, 0, invalidValue);
        assertFalse(location.isAccuracyPresent());

        SimpleLocation location2 = new SimpleLocation(0, 0, 0, 0, validValue);
        assertTrue(location2.isAccuracyPresent());
    }
}
